Unless otherwise indicated herein, the materials described in this section are not prior art to the claims in this application and are not admitted to be prior art by inclusion in this section.
In computer science, a lock is typically a synchronization mechanism for enforcing limits on access to resources in environments where there are more than one thread of execution. Locks are one way of enforcing concurrency control policies. Example locks include advisory locks, in which threads cooperate by acquiring locks before accessing corresponding resources, and releasing locks thereafter. Other example locks include mandatory locks, in which an attempt by a thread to access to a locked resource forces an exception in the thread attempting to make the access.
Some locking technologies may employ binary semaphores, in which no distinction is made between shared (read only) or exclusive (read and write) modes. Other locking technologies may employ a range of locking modes. For example, locking strategies may provide a shared mode, in which multiple threads can simultaneously acquire a shared lock for read-only access to a resource, and an exclusive mode, in which threads may acquire exclusive locks for read/write access to the resource.
Locking technologies may also employ a variety of outcomes when locks prevent progress of threads. For example, some locking technologies may block execution of threads requesting locks until corresponding resources becomes available. A “spinlock” is a lock for which threads wait (“spin”) until requested locks become available to requesting threads. Other locking technologies may employ any of a range of other outcomes for requesting threads.
Locking technologies may be implemented by Operating Systems (OS), in runtime environments such as those provided by widespread JAVA® technologies, and/or in hardware and by cooperation between such entities. For example, lock instructions may be issued by threads to a supporting OS, runtime environment, and/or to hardware, and the OS, runtime environment, and/or hardware may place and release locks according to received lock instructions and according to the particular locking technologies deployed in the OS, runtime environment, and/or hardware.
Locking technology implementation is non-trivial, and lock-related problems are a widespread source of computer system malfunction, in both consumer grade and professionally managed computing systems. Some locking problems include blocking; race conditions; and deadlocks. Locking technologies also introduce complexity and scalability issues in software design.